[?php slot('sf_admin.filters') ?]

  [?php include_stylesheets_for_form($form) ?]
  [?php include_javascripts_for_form($form) ?]
  
  [?php $columns = <?php echo intval(@$this->params['filter_columns']) ? intval($this->params['filter_columns']) : 2 ?> ?]
  
  
  <div class="sf_admin_filter">
    [?php if ($form->hasGlobalErrors()): ?]
      [?php echo $form->renderGlobalErrors() ?]
    [?php endif; ?]
  
    <form action="[?php echo url_for('<?php echo $this->getUrlForAction('collection') ?>', array('action' => 'filter')) ?]" method="post">
      <table cellspacing="0">
        <tfoot>
          <tr>
            <td colspan="2">
              [?php echo $form->renderHiddenFields() ?]
              [?php echo link_to(__('Reset', array(), 'sf_admin'), '<?php echo $this->getUrlForAction('collection') ?>', array('action' => 'filter'), array('query_string' => '_reset', 'method' => 'post')) ?]
              <input type="submit" value="[?php echo __('Filter', array(), 'sf_admin') ?]" />
            </td>
          </tr>
        </tfoot>
        <tbody>
          <tr>
          [?php for ($i=0; $i < $columns; $i++):?]
            <td valign="top">
              <table cellspacing="0">
                
                [?php $inColumn = floor(count($configuration->getFormFilterFields($form)) / $columns)  ?]
                [?php if ($i == $columns - 1): ?]
                  [?php $items = array_slice($configuration->getFormFilterFields($form), $i * $inColumn) ?]
                [?php else: ?]
                  [?php $items = array_slice($configuration->getFormFilterFields($form), $i * $inColumn, $inColumn ) ?]
                [?php endif ?]
                
                
                [?php foreach ($items as $name => $field): ?]
                [?php if ((isset($form[$name]) && $form[$name]->isHidden()) || (!isset($form[$name]) && $field->isReal())) continue ?]
                  [?php include_partial('<?php echo $this->getModuleName() ?>/filters_field', array(
                    'name'       => $name,
                    'attributes' => $field->getConfig('attributes', array()),
                    'label'      => $field->getConfig('label'),
                    'help'       => $field->getConfig('help'),
                    'form'       => $form,
                    'field'      => $field,
                    'class'      => 'sf_admin_form_row sf_admin_'.strtolower($field->getType()).' sf_admin_filter_field_'.$name,
                  )) ?]
                [?php endforeach; ?]
              </table>
            </td>
          [?php endfor ?]
          </tr>
        </tbody>
      </table>
    </form>
    <div class="minimize-filter" id="filter-switcher">Show Filter</div> 
  </div>
[?php end_slot() ?]
